package cn.sangyy.gift.auth.client;

import cn.sangyy.gift.common.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author SangYY
 * @date: 2023/03/29/23:01
 */
@Component
@Slf4j
public class LoginUserClientFallBackFactory implements FallbackFactory<LoginUserClient> {
    @Override
    public LoginUserClient create(Throwable throwable) {
        return loginUser -> {
            throwable.printStackTrace();
            log.error("系统异常"+throwable.getMessage());
            return AjaxResult.me().setCode(201).setMessage("系统异常，请联系管理员");
        };
    }
}
